const path = require('path');

console.log(__dirname);
console.log(__filename);
// 相对路径： /根目录  ./当前目录  ../返回上一级
// 绝对路径实例：C:\Users\HP\Desktop\NodeJs-demo\class

// 1.解析路径 path.parse
console.log('path.parse:',path.parse(__filename).ext);
console.log('path.parse:',path.parse(__dirname));

// 2.获取路径名 path.basename
console.log('path.basename:',path.basename(__filename));
console.log('path.basename:',path.basename(__dirname));

// 3.路径名 path.dirname
console.log('path.dirname:',path.dirname(__dirname));
console.log('=========================')

// 4.文件的后缀名 path.extname
console.log('path.extname:',path.extname(__filename));
console.log('path.extname:',path.extname(__dirname));

// 5.路径拼接 path.join
console.log('路径拼接',path.join(__dirname,'a/b/c/d','525path.js'));